import request from '@/api/request/axios'

// 查询会话业务轨迹
export const querySessionLabelInfo = (tenantId, cusNum) => request({
  url: window.CONFIG.freelinkconfigApi + '/v1/platform/data/label/querySessionLabelInfo/' + tenantId + '/' + cusNum,
  method: 'get'
})

function random(min, max) {
  return Math.floor(Math.random() * (max - min)) + min
}

export function recommend() {
  // 半径
  const radius = $('.picture').width() / 2 + 50
  // 每一个BOX对应的角度;
  const avd = 360 / $('.labelItem').length
  // 每一个BOX对应的弧度;
  const ahd = avd * Math.PI / 180
  const colorArr = ['#0D88F0', '#2FB384', '#FF3939', '#F5AA3E', '#3FC0F5']
  $('.labelItem').each(function(index, ele) {
    const randomNum = random(0, 4)
    const color = colorArr[randomNum]
    $(this).css({
      'background': color,
      'color': '#fff',
      'left': Math.sin((ahd * index)) * radius - 15,
      'top': Math.cos((ahd * index)) * radius + 30
    })
  })
}
